package com.stiove.whwh.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.stiove.whwh.dao.pojo.Ticket;
import com.stiove.whwh.dao.pojo.User;
import com.stiove.whwh.vo.OrderVo;
import com.stiove.whwh.vo.TicketImgVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface TicketMapper extends BaseMapper<Ticket> {
    @Select("select * from ticket where (id = #{id} and delete_time is NULL ) limit 1  ")
    public Ticket selectTicketById(Long id);

    @Update("update ticket SET delete_time = #{time} where id = #{id}")
    public int delById(int id,long time);

    @Select("SELECT" +
            " ticket.id,ticket.title,ticket.price,ticket.city,ticket_img.img_url" +
            " FROM ticket,ticket_img where (ticket.id = #{id} and ticket.id = ticket_img.ticket_id ) limit 1")
    public TicketImgVo selectTicketInfoById(Long id);
}
